package no.sachmuld.methodcombination.examples.annotation.roles.observer;

import no.sachmuld.aspectjattach.AspectJAgent;

/**
 *
 */
public class Main implements Runnable {

    @Override
    public void run() {

        AspectJAgent.initializeIfNeeded();

        new Runnable() {

            @Override
            public void run() {

                Observer fooObserver = new Observer() {
                    @Override
                    public void update(Object observable) {
                        System.out.println(observable + " changed!");
                    }
                };

                Foo foo = new Foo().with(new ObservableBehaviour());

                foo.as(Observable.class).addObserver(fooObserver);

                foo.bar(1);
            }

        }.run();

    }

    static public void main(String... args) {

        new Main().run();

    }
}
